-
Notifications
You must be signed in to change notification settings - Fork 477
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make the to_bytes/from_bytes round trip of ExpandedSecretKey idempotent #541
Make the to_bytes/from_bytes round trip of ExpandedSecretKey idempotent #541
Conversation
@poljar what's your use case for |
It's worth doing https://gitweb.torproject.org/torspec.git/tree/proposals/224-rend-spec-ng.txt#n2135 but this could be expressly supported if whatever way you like. Ed25519-BIP32 is a mess, so maybe ignore it. |
As explained in dalek-cryptography/ed25519-dalek#298 (comment), We are migrating from So the methods are useful to me, of course I can work around struct MyExpandedSecretKey {
source: Box<[u8; 64]>,
inner: ExpandedSecretKey
} But it does feel a bit strange to not have this method since as far as I can tell, every other type in the ecosystem can be converted to/from a byte slice or array. |
The downside is supporting this incredibly niche use case requires making a second copy of the secret key in memory for all users, just to store the unclamped version. It makes the type 50% larger in memory, and it’s one more thing that needs zeroized (which is also currently missing, I believe) |
I also proposed in the comments of #544 that we remove |
Well, as I said, I can live with this. Just need to implement the above mentioned code snippet in my lib. Should I close this then or do you guys want to merge this to have correct behavior until the other PRs are ready? |
We decided to get rid of Superseded by #545 |
A mistake snuck in with 9b166b7. The new
scalar_bytes
field of theExpandedSecretKey
is not used in theExpandedSecretKey::to_bytes()
method, instead the, now clamped,scalar
is used.This in turn means that the following snippet won't produce the same
ExpandedSecretKey
:Down the line, it means that serializing/deserializing this struct will produce differing keys and thus spurious signature verification errors.
Transferred from: dalek-cryptography/ed25519-dalek#308.